# 函数read() 函数：
# 逐个字节或者字符读取文件中的内容，
# 如果read内包含参数，则根据参数所指定的值，读取指定数量值的字节或字符;


with open("file.txt","r") as f:
    x=f.read(4)
    print(x)







# with open('file.txt', 'r') as f:
#     msg=f.read()
#     print(msg)


# with open('file.txt', 'r') as f:
#     msg=f.read(14)    #回车是一个字符
#     print(msg)




# f = open('file.txt', 'r')
# msg=f.read()
# f.close()
# print(msg)